<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::get('/notify', 'NotifyController@index');
Route::get('/debug-sentry', function () {
    throw new Exception('My first Sentry error!');
});

Route::post('/address', getRouterController('AddressController', 'store'));
Route::get('/mail', getRouterController('MailController', 'index'));

//用户中心

//商品中心
//商品列表
//Route::post('/goods/list', getRouterController('GoodsController', 'index'));
//商品详情
Route::post('/goods/:id', getRouterController('GoodsController', 'detail'));
//推荐商品列表
Route::post('/goods/recommends', getRouterController('GoodsController', 'recommends'));

//订单中心

//微信认证

$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
    $api->post('/goods/list', 'App\Http\Controllers\Api\V1_0_0\GoodsController@index');
    $api->post('/redis/rank', 'App\Http\Controllers\Api\V1_0_0\RedisController@rank');
    $api->post('/redis/count', 'App\Http\Controllers\Api\V1_0_0\RedisController@count');
});
